/*******************************************************************************
 * Copyright 2011 Towee.net
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *******************************************************************************/
package net.towee.client.managers;

import java.util.List;

import net.towee.client.event.core.AccountIdentityUpdatedEvent;
import net.towee.client.event.core.AccountProfileUpdatedEvent;
import net.towee.model.account.AccountIdentity;
import net.towee.model.account.AccountProfile;

import com.google.gwt.user.client.rpc.AsyncCallback;

/**
 * This interface define manager that works with accounts. It contain methods
 * for getting and changing account data. Also it contain some useful methods
 * for manipulating with logged in account data.
 * 
 * <ul>The implementation MUST handler this PUSH events:
 * <li>When some user update his identity - {@link AccountIdentityUpdatedEvent}</li>
 * <li>When some user update his profile - {@link AccountProfileUpdatedEvent}</li>
 * <li>User online state change - {@link UserOnlineStateUpdatedEvent}</li>
 * </ul>
 * 
 * @author viiv.c58@gmail.com (Artem Artem'ev)
 */
public interface AccountsManager {
	/**
	 * This method get AccountData of logged in account and store it in some
	 * feild for fast manipulating with data. When user data recived it fire
	 * UserAccepted event.
	 */
	void initializeAccount();

	/**
	 * Get async account profile with given accountId
	 * 
	 * @param accountId
	 * @param handler
	 */
	void getAccountProfile(String accountId, AsyncCallback<AccountProfile> handler);

	/**
	 * Get async account identity with given accountId
	 * 
	 * @param accountId
	 * @param handler
	 */
	void getAccountIdentity(String accountId, AsyncCallback<AccountIdentity> handler);

	/**
	 * Check account existing with some nickname
	 * 
	 * @param nickname
	 * @param handler
	 */
	void checkAccountWithNicknameExists(String nickname, AsyncCallback<Boolean> handler);
	
	/**
	 * Simple user finder. Search by identity
	 * @param str
	 * @param offset TODO
	 * @param limit TODO
	 * @param handler
	 */
	void findAccount(String str, int offset, int limit, AsyncCallback<List<AccountIdentity>> handler);
}